$import( "SmitearWebGL.Objects.Parser.Collada.DaeEntity" );
$import( "SmitearWebGL.Objects.Parser.Collada.DaeColorOrTexture" );

SmitearWebGL.Objects.Parser.Collada.DaeConstant = SmitearWebGL.Objects.Parser.Collada.DaeEntity.extend(
{
	/******** constructor ********/

	init : function( document, node )
	{
		this.emission = null;
		this.reflective = null;
		this.transparent = null;
		this.reflectivity = 0;
		this.transparency = 0;
		this.index_of_refraction = 0;

		this._super( document, node );
		this._registClass( "SmitearWebGL.Objects.Parser.Collada.DaeConstant" );
	}
	,
	read : function( node )
	{
		this._super( node );

		var children = node.childNodes;

		for( var i = 0; i < children.length; i++ )
		{
			var child = children[i];

			switch( child.localName )
			{
				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_EMISSION_MATERIAL_PARAMETER:
					this.emission = new SmitearWebGL.Objects.Parser.Collada.DaeColorOrTexture( this.document, child );
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_REFLECTIVE_MATERIAL_PARAMETER:
					this.reflective = new SmitearWebGL.Objects.Parser.Collada.DaeColorOrTexture( this.document,  child );
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_TRANSPARENT_MATERIAL_PARAMETER:
					this.transparent = new SmitearWebGL.Objects.Parser.Collada.DaeColorOrTexture( this.document, child );
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_REFLECTIVITY_MATERIAL_PARAMETER:
					this.reflectivity = parseFloat( this.getNodeContent( this.getNode( child, "float" ) ) );
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_TRANSPARENCY_MATERIAL_PARAMETER:
					this.transparency = parseFloat( this.getNodeContent( this.getNode( child, "float") ) );
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_INDEXOFREFRACTION_MATERIAL_PARAMETER:
					this.reflectivity = parseFloat( this.getNodeContent( this.getNode( child, "float") ) );
					break;

				default:
					break;
			}
		}
	}
}
);